Assigning actions to buttons

Assign an action to an instance of a button to have the action run when the user clicks or rolls over a button. Assigning an action to a button instance doesn't affect other instances of the button.

When assigning an action to a button, you specify the mouse events that trigger the action. You can also assign a keyboard key that triggers the action.

To assign an action to a button:

1 Select a button instance and choose Modify > Instance, or double-click the button instance.
2 Click the Actions tab.
3 Click the + (plus) and choose a statement from the pop-up menu.
If the Actions tab is not available, the selected instance is not a button. You can click the Definition tab and make the selected instance behave as a button, but the instance probably will not have the special button states associated with it. See Creating buttons.
When you choose a statement, Flash automatically inserts an On/End On statement and sets Release as the default button state. You can also select On MouseEvent to insert an On/End On statement.
4 In the Parameters pane, with the On (Release) statement highlighted, select which mouse and keyboard events trigger the action:
Press Occurs when the mouse button is pressed while the pointer is over the button.
Release Occurs when the mouse button is released while the pointer is over the button. This sets up standard clicking behavior.
Release Outside Occurs when the mouse button is released while the pointer is outside the button.
Roll Over Occurs when the pointer rolls over the button.
Roll Out Occurs when the pointer rolls outside the button.
Drag Over Occurs after the mouse button has been pressed while the pointer is over the button, rolled outside the button, and then the pointer is rolled back over the button.
Drag Out Occurs when the mouse button is pressed over the button and the pointer then rolls outside the button.
Key Press Occurs when the specified key is pressed.
5 Click the + (plus) and choose a statement from the pop-up menu.
Depending on the action you choose, the Parameters pane can offer additional parameters for the statement. For information about a specific statement, see the topics later in this chapter. You can also look up specific statements in the Index.
If you are familiar with basic programming techniques, you can enter parameters that Flash can evaluate when the movie is playing. See Writing expressions.
6 Assign any additional statements that you want.
Flash inserts the statement below the currently selected action. Use the up and down buttons to change the order of statements.

To test a button:

Choose Control > Enable Buttons before playing the movie.